package com.example.yadmin.sys.mapper;

import com.example.yadmin.common.vo.Result;
import com.example.yadmin.sys.entity.Chat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ag
 * @since 2023-11-04
 */
public interface ChatMapper extends BaseMapper<Chat> {
    @Select("SELECT * FROM y_chat GROUP BY time")
    public List<Chat> getChatGroupByTime();

    @Select("SELECT * from y_chat WHERE talk_id = #{talkId} GROUP BY time")
    public List<Chat> getChatByTalkId(Integer talkId);

    @Select("SELECT a.* FROM y_chat a , y_talk b WHERE a.time BETWEEN b.start_time AND b.end_time AND b.talk_id = #{talkId}")
    public List<Chat> getChatInfoByTalkId(Integer talkId);
}
